/// 🎯 活动编辑响应模型
/// 
/// 封装后端返回的活动编辑结果
/// 对应接口: POST /activities/edit
class ActivityEditResp {
  final String status;
  final String message;
  final int? activityId;
  final Map<String, dynamic>? extraData;

  ActivityEditResp({
    required this.status,
    required this.message,
    this.activityId,
    this.extraData,
  });

  /// 是否成功
  bool get isSuccess => status == 'success';

  /// 从JSON创建实例
  factory ActivityEditResp.fromJson(Map<String, dynamic> json) {
    return ActivityEditResp(
      status: json['status'] ?? 'error',
      message: json['message'] ?? '活动编辑失败',
      activityId: json['activity_id'] is String 
          ? int.tryParse(json['activity_id'])
          : json['activity_id'],
      extraData: json['extra_data'] as Map<String, dynamic>?,
    );
  }

  /// 转换为JSON
  Map<String, dynamic> toJson() {
    return {
      'status': status,
      'message': message,
      if (activityId != null) 'activity_id': activityId,
      if (extraData != null) 'extra_data': extraData,
    };
  }

  @override
  String toString() {
    return 'ActivityEditResp{status: $status, message: $message, activityId: $activityId}';
  }
}

